package edu.hubu.commons;

import java.util.ArrayList;
import java.util.List;

/**
 * @author moonlan
 * @date 2020/10/27 下午1:22
 */
public class Object2List {

    public static <T> List<T> toList(Object obj, Class<T> clazz) {
        List<T> result = new ArrayList<T>();
        if (obj instanceof List<?>) {
            for (Object o : (List<?>) obj) {
                result.add(clazz.cast(o));
            }

            return result;
        }
        return null;
    }

}
